package cn.iocoder.yudao.module.diy.api.config;

import cn.hutool.json.JSONObject;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.diy.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.security.PermitAll;

@FeignClient(name = ApiConstants.NAME) // TODO 芋艿：fallbackFactory =
@Tag(name = "RPC 服务 - 插件用于创建租户的时候生成装修页面")
public interface DiyConfigApi {
    String PREFIX = ApiConstants.PREFIX + "/config";

    @GetMapping(PREFIX + "/get")
    @Operation(summary = "创建装修模板")
    @Parameters({
            @Parameter(name = "tenantId", description = "租户id", example = "1", required = true),
            @Parameter(name = "key", description = "配置值", required = true, example = "wechat")
    })
    @PermitAll
    CommonResult<String> getConfig(@RequestParam("tenantId") Long tenantId, @RequestParam("key") String key);

    @GetMapping(PREFIX + "/getValue")
    @Operation(summary = "创建装修模板")
    @Parameter(name = "key", description = "配置值", required = true, example = "wechat")
    @PermitAll
    CommonResult<String> getConfigValue(@RequestParam("key") String key);
}
